package com.vise.facedemo.alioss.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.vise.facedemo.alioss.fragment.One_Fragment;
import com.vise.facedemo.alioss.fragment.Three_Fragment;
import com.vise.facedemo.alioss.fragment.Two_Fragment;


/**
 * Created by 智江鹏 on 2016/11/18.
 * 中转站 大众 街道 适配器
 */

public class Menu_FragmentAdapter extends FragmentPagerAdapter {
    private String[] titleStr = null;
    public One_Fragment one_fragment;
    public Two_Fragment two_fragment;
    public Three_Fragment three_fragment;


    private static final String[] CONTENT = new String[]{"体质分析", "日常调养", "食物疗养"
    };


    public Menu_FragmentAdapter(FragmentManager fm, Context context) {
        super(fm);


        titleStr = CONTENT;


    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                if (one_fragment == null) {
                    one_fragment = new One_Fragment();
                }
                return one_fragment;
            case 1:
                if (two_fragment == null) {
                    two_fragment = new Two_Fragment();
                }
                return two_fragment;
            case 2:
                if (three_fragment == null) {
                    three_fragment = new Three_Fragment();
                }
                return three_fragment;
            default:
                return null;
        }


    }

    @Override
    public CharSequence getPageTitle(int position) {

        return titleStr[position];
    }

    @Override
    public int getItemPosition(Object object) {

        return POSITION_NONE;
    }

    @Override
    public int getCount() {

        return titleStr.length;
    }

}
